<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>改变盒子大小</title>
		<style type="text/css">
			#box{
				width: 50px;
				height: 50px;
				margin: 0 auto;
				background: yellowgreen;
				text-align: center;
				
			}
		</style>
	</head>
	<body>
		<div id="box"></div>
		<script type="text/javascript">
			//根据用户的点击次数完成改变盒子大小改变
			//单机的次数为奇数时，盒子变大（文字），单击次数为偶数时,盒子变小；
			var box=document.getElementById('box')
			var a=0;
			box.onclick=function(){
				a++
				if (a%2==0) {
					box.innerHTML='大'
					box.style.width='50px'
					box.style.height='50px'
				} else{
					box.innerHTML='小'
					box.style.width='150px'
					box.style.height='150px'
				}
			}
		</script>
	</body>
</html>
